<template>
  <BaseDialogTableSelect ref="dialogTableSelect" @selection-change="handleSelectionChange" v-bind="$attrs">
    <template #queryItems="{queryParams}">
      <el-form-item label="名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学期" prop="semester">
        <el-select v-model="queryParams.semester" placeholder="请选择学期" clearable>
          <el-option
            v-for="dict in dict.type.jy_semester"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="学科" prop="subject">
        <el-select v-model="queryParams.subject" placeholder="请选择学科" clearable>
          <el-option
            v-for="dict in dict.type.jy_subject"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="年级" prop="grade">
        <el-select v-model="queryParams.grade" placeholder="请选择年级" clearable>
          <el-option
            v-for="dict in dict.type.jy_grade"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="停用状态" prop="state">
        <el-select v-model="queryParams.state" placeholder="请选择停用状态" clearable>
          <el-option
            v-for="dict in dict.type.sys_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
    </template>
    <template v-slot:tableColumns>
      <el-table-column label="名称" align="center" prop="name"/>
      <el-table-column label="学期" align="center" prop="semester">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.jy_semester" :value="scope.row.semester"/>
        </template>
      </el-table-column>
      <el-table-column label="学科" align="center" prop="subject">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.jy_subject" :value="scope.row.subject"/>
        </template>
      </el-table-column>
      <el-table-column label="年级" align="center" prop="grade">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.jy_grade" :value="scope.row.grade"/>
        </template>
      </el-table-column>

      <el-table-column label="停用状态" align="center" prop="state">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.state"/>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark"/>
    </template>
  </BaseDialogTableSelect>
</template>

<script>
  import BaseDialogTableSelect from '@/components/BaseDialogTableSelect/index.vue'
  import {listJyResearchGroup} from "@/api/research/jyResearchGroup"


  export default {
    name: "JyResearchGroupSelect",
    dicts: ['jy_grade', 'jy_semester', 'sys_yes_no', 'jy_subject'],
    components: {BaseDialogTableSelect},
    data() {
      return {
        open: false,
        loading: false
      }
    },
    methods: {
      show() {
        this.$refs.dialogTableSelect.show()
      },
      handleSelectionChange(select) {
        this.$emit("selection-change", select)
      },
      getList(queryParams) {//数据查询
        return listJyResearchGroup(queryParams)
      },
      getRowKey(item) {
        return item.id
      }
    }
  }
</script>

<style scoped>

</style>
